#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<math.h>
int palindromic(int n)
{
    int count = 0;
    int number = n;
    int temp = n;
    int rev = 0;
    while (number)
    {
        number /= 10;
        count++;
    }
    while (temp)
    {
        rev += (temp % 10) * pow(10, count - 1);
        count--;
        temp /= 10;
    }
    if (rev == n)
        return 1;
    else
        return 0;
}
int main()
{
    int n = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        if (palindromic(i))
        {
            printf("%d\n", i);
        }
    }

    return 0;
}